package org.openwp3x.iclazz;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class ViewAd extends Activity {

	public TextView adDesc;
	public TextView publisherName;
	public TextView publisherEmail;
	public Button btViewProfile;

	@Override
	public void onCreate(final Bundle icicle) {
		super.onCreate(icicle);
		setContentView(R.layout.item_detail);

		Intent intent = getIntent();
		Bundle bundle = intent.getExtras();
		Long adId = bundle.getLong("adId");
		String adDesc = bundle.getString("adDesc");
		final Long publisherId = bundle.getLong("publisherId");
		String publisherName = bundle.getString("publisherName");
		String publisherEmail = bundle.getString("publisherEmail");

		this.adDesc = (TextView) findViewById(R.id.dt_ad_desc);
		this.publisherName = (TextView) findViewById(R.id.dt_publisher_name);
		this.publisherEmail = (TextView) findViewById(R.id.dt_publisher_email);
		this.btViewProfile = (Button) findViewById(R.id.btnProfile);

		this.adDesc.setText(adDesc);
		this.publisherName.setText(publisherName);
		this.publisherEmail.setText(publisherEmail);

		this.btViewProfile.setOnClickListener(new View.OnClickListener() {
			public void onClick(final View v) {
				Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(IClazz.getURL("/user/profile?userId=" + publisherId)));
				startActivity(myIntent);
			}
		});

	}

}
